UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cfqnkisESyeqIsqtUSf+WAG+4GA2Dm6x3CmThPe1CNk=' 
WHERE 
  key_id = '5986b74a9fb8eb85d29958995556f7087ad34da9cbf7d3cbe08a118e80c1d3ff' 
  AND (
    token = 'cfqnkisESyeqIsqtUSf+WAG+4GA2Dm6x3CmThPe1CNk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027