UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C8kMEuBZegd7eLDzFM163IbHro2q5uvaQdzM08MYY4Y=' 
WHERE 
  key_id = '64a7dbece7d6d8799af69c38ba99455c6da4351803af142262830f8b52edd3a5' 
  AND (
    token = 'C8kMEuBZegd7eLDzFM163IbHro2q5uvaQdzM08MYY4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030