UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ecMxyfPLPX2qSTAxQ0Ya65bHEzfOuz0+dHqBg9D4de0=' 
WHERE 
  key_id = 'd116f5e396135fdb3fccde66ae5c3279410f3e558025b7ca0537cc45ba8be88c' 
  AND (
    token = 'ecMxyfPLPX2qSTAxQ0Ya65bHEzfOuz0+dHqBg9D4de0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035