UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cnw0Np46H7CcSeVUZApnY93/x47laL7wpfYYtvfcneA=' 
WHERE 
  key_id = '8d38aa041b295757e9a106a038630c8b1c165fa9fb5bc12cc21eb8282e8f2cdf' 
  AND (
    token = 'Cnw0Np46H7CcSeVUZApnY93/x47laL7wpfYYtvfcneA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018