UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HAlMBvJiOB+MeHSULwnQAroaFlX66TKwUZ7FkKoqwA4=' 
WHERE 
  key_id = 'f3eb63b6bd77b5ecad2c0b41d71fa11ec0565c2111b5d6e119fe341a14cea63c' 
  AND (
    token = 'HAlMBvJiOB+MeHSULwnQAroaFlX66TKwUZ7FkKoqwA4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047