UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KcaT8/CfZKPKAbqcXYMDr7vLLGNv/mcRLpQqaxOWuAw=' 
WHERE 
  key_id = '3f0b8d1d7c58f767f496dff364b82f9805d7b4b4493bc2ca13c38a642d755f2e' 
  AND (
    token = 'KcaT8/CfZKPKAbqcXYMDr7vLLGNv/mcRLpQqaxOWuAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031