UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CFMXoBD6JX299smOcr03uTU3fAq8WBJL3ALvFDkJckA=' 
WHERE 
  key_id = '0949f13decb3078ea745b80c1e9302da4069b222b9bae5217b60409de2f720d0' 
  AND (
    token = 'CFMXoBD6JX299smOcr03uTU3fAq8WBJL3ALvFDkJckA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019