UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yOdkk4C3DKpnTQgLraW5GT32xArhECj0ZQ0hnY+Vw+k=' 
WHERE 
  key_id = '9723cd7133bc1d5a655100c810c8e1789c47e8a5e8138623e9f256bd77d53c2e' 
  AND (
    token = 'yOdkk4C3DKpnTQgLraW5GT32xArhECj0ZQ0hnY+Vw+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031