UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k+Fd2spzZ/IklCjUk4v97sqjLDua+CdFJsE7IMRf+SM=' 
WHERE 
  key_id = 'e67b483fae578bd5dfc9999226affb668f32c8664611c52c31960fb60d6d3262' 
  AND (
    token = 'k+Fd2spzZ/IklCjUk4v97sqjLDua+CdFJsE7IMRf+SM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052