UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IAk+iuXtTbzKOKM5GH/2n8VkpBYfqu9c3OwEaRTstnM=' 
WHERE 
  key_id = '58629789ed31e28df862a8e767a261cb42011a08d60ad097bb706893ee6a9f9b' 
  AND (
    token = 'IAk+iuXtTbzKOKM5GH/2n8VkpBYfqu9c3OwEaRTstnM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048