UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ecwi/0vyYkWoNE8HtvqSkJLlpGmsgJNrsmuZZIos4xY=' 
WHERE 
  key_id = '712d2b8a928837362008be3bdb620aa70acec7b4313edeb6b031638dcb1c33f1' 
  AND (
    token = 'ecwi/0vyYkWoNE8HtvqSkJLlpGmsgJNrsmuZZIos4xY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00086