UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MCpj/QSxdlm7K8uzclE5UEAtODX+xghUQMV/NZrchcE=' 
WHERE 
  key_id = '5f6de9ba2cf814c593447bd5ea6a07ac05751dde4b4cab38189e337f77dfb08c' 
  AND (
    token = 'MCpj/QSxdlm7K8uzclE5UEAtODX+xghUQMV/NZrchcE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031