UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'buNSLEH6ZRwWhKdIcipir23YGuoDIrR8Cr4lYAA+VLc=' 
WHERE 
  key_id = '9104759a1b4db388bafbafb266d22b3523fcbb90dee9edbef161f82e1cbce634' 
  AND (
    token = 'buNSLEH6ZRwWhKdIcipir23YGuoDIrR8Cr4lYAA+VLc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032