UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZQRPXzfWzsxYCFcpqUoFM/d9mpBoiICnn5HYHYWbsxY=' 
WHERE 
  key_id = 'c721ae45f4e8b459a0228474cf3ffe0e3977906cc0fdd0712769bd6ff2083af5' 
  AND (
    token = 'ZQRPXzfWzsxYCFcpqUoFM/d9mpBoiICnn5HYHYWbsxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036