UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YP7m3B3QwwzWLsGNr5BtEdd5DtVjFiHfVD54ISJxyNo=' 
WHERE 
  key_id = '431f38ff9f178b1706c1f198367db1e7bc235170e11ff836f69aac89d2e7d990' 
  AND (
    token = 'YP7m3B3QwwzWLsGNr5BtEdd5DtVjFiHfVD54ISJxyNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032