UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lEALssL6Oh3eNkfXBjUpTAwJTfTi7jvZgIHe2rSLdWI=' 
WHERE 
  key_id = '17e3bd51f3872cd4766b9df9cd2104c6a074f3fb8cd4c624d059010b96131039' 
  AND (
    token = 'lEALssL6Oh3eNkfXBjUpTAwJTfTi7jvZgIHe2rSLdWI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039