UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LnYfmWr/FjP9x2vrKKDlk0ffXO6LsnrPYzlTfN40jZk=' 
WHERE 
  key_id = 'a9378ab8fc5d93de04c2edb02f9d4fba998484a80e3a600b88f7fc665f52530f' 
  AND (
    token = 'LnYfmWr/FjP9x2vrKKDlk0ffXO6LsnrPYzlTfN40jZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052