UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tNg2mGfMp61LZ18rnfAVHh6CkKkXReP4EZi1X7j90so=' 
WHERE 
  key_id = '91f433129b47c348934a1b7fe9ffa0962354b6fc6653fc790c0e7b94bb349f78' 
  AND (
    token = 'tNg2mGfMp61LZ18rnfAVHh6CkKkXReP4EZi1X7j90so=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046