UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CGdRtB0O00bjInG8fhYw4D5ARAZkgsQg88mQQ1LSjuE=' 
WHERE 
  key_id = '8579844575230c358230ac6402fb553659e6866ac851e78a6f674290fca9b5f7' 
  AND (
    token = 'CGdRtB0O00bjInG8fhYw4D5ARAZkgsQg88mQQ1LSjuE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042