UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KOr4Url8kogfV5yQn0y6bBjRhNwUtyVEQ+kqbnh7erQ=' 
WHERE 
  key_id = '27c504d62dbca5ec998deaedf5678c23fc97f92bc0ff009470aa02fda4b8fee1' 
  AND (
    token = 'KOr4Url8kogfV5yQn0y6bBjRhNwUtyVEQ+kqbnh7erQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043