UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8g1KJ6Ni5vsCSv3YrJkjqUaIHNu9n2+RuAKQ27JRcT4=' 
WHERE 
  key_id = '0222a4984527039e759a14584853b8e0abc4e16dcabae4f2aec6d2656b135ab8' 
  AND (
    token = '8g1KJ6Ni5vsCSv3YrJkjqUaIHNu9n2+RuAKQ27JRcT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033