UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'saP1u59LSzqGOkDFA2JNoyGI+yIr5fuEWN8eSlHkEk4=' 
WHERE 
  key_id = 'd21a75ad4ffa52c3bd253e1037e3ec3a0b4b512b4474bf240afe30b9f2d59a11' 
  AND (
    token = 'saP1u59LSzqGOkDFA2JNoyGI+yIr5fuEWN8eSlHkEk4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027