UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UMF5J8iGcAPcVfvnu+VeU0u1Acm2l4A0knvWYm94s2I=' 
WHERE 
  key_id = '334162c214fb61b516750e0f48abf289b29266428edfe22c68a171078c06c2b8' 
  AND (
    token = 'UMF5J8iGcAPcVfvnu+VeU0u1Acm2l4A0knvWYm94s2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038