UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H9LPqx3Yc+ivSZM34irxBfpcqWL7Em9TJC0OSPzJLP0=' 
WHERE 
  key_id = '2aeb76efffc7bf8b174e8cacf021bd9cf3b6889c607118e585428867d53766fc' 
  AND (
    token = 'H9LPqx3Yc+ivSZM34irxBfpcqWL7Em9TJC0OSPzJLP0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029