UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NtNEqCy2x5/CrXVBEOfu5oIUpBLtnDRUN8CqAgImnKM=' 
WHERE 
  key_id = '1fdda06f0f6c21702145c0f072a256df8f6b67587dac832cdb5b52369ad942e5' 
  AND (
    token = 'NtNEqCy2x5/CrXVBEOfu5oIUpBLtnDRUN8CqAgImnKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026