UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r02i3iI/MphI7JvOp8EypfMsLCsQfSwqCV5PIOWSs6Q=' 
WHERE 
  key_id = '94529a807cb385974bb2b5902b4dfd78e8fc4c485cdf419bc574ac47864618a7' 
  AND (
    token = 'r02i3iI/MphI7JvOp8EypfMsLCsQfSwqCV5PIOWSs6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035