UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k1tMI4o6uQxwcPW+Ri8nUdTOxwunkclull4VkAtrF0o=' 
WHERE 
  key_id = '720420904bd850c54a9f2325a5f675033a19cb53ca78f0a19b73eeeb7b26354b' 
  AND (
    token = 'k1tMI4o6uQxwcPW+Ri8nUdTOxwunkclull4VkAtrF0o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052