UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '460gXN/fTZbizfOE99JSfublFBlX+rpwzA0w5Wbui3E=' 
WHERE 
  key_id = '42bd92a623d9effc5d56ceac8950501bba01dee3d317c3147b90d4182ba4f271' 
  AND (
    token = '460gXN/fTZbizfOE99JSfublFBlX+rpwzA0w5Wbui3E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049