UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YhFR+N8wg7V2dzUXSSWjFnn5LZHwhibzmshNe8Fo/Kk=' 
WHERE 
  key_id = 'f085d939abb8d7a6dbd45aff95b5c97e0ab1433badc898c920028009ab0bbccc' 
  AND (
    token = 'YhFR+N8wg7V2dzUXSSWjFnn5LZHwhibzmshNe8Fo/Kk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052