UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hODbmzm6uBmOQT7b/B+DeRZLbTpRWf8Cd2EZvSTddhs=' 
WHERE 
  key_id = '1c611f60a6eee32b2e1aed796698afcc08adeda91044d47bee243f9b0c5feff8' 
  AND (
    token = 'hODbmzm6uBmOQT7b/B+DeRZLbTpRWf8Cd2EZvSTddhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047