UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G6IzhmjZxt5ZMk/riKnGPk2kC+G7a07y9wahy/dZuko=' 
WHERE 
  key_id = '8671191baab78cc4647f52a32cf835fdf2ed54983803341ced5f725efb1c3cd5' 
  AND (
    token = 'G6IzhmjZxt5ZMk/riKnGPk2kC+G7a07y9wahy/dZuko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041