UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TgVm1MYqx4SMXZEgj3QmLXjcDLDuJBTU7/kWQ4I7S9E=' 
WHERE 
  key_id = '2e8d3d86da9e8ded80c340bf9a983894a99d38ff5edc4b4201943516afeadd6a' 
  AND (
    token = 'TgVm1MYqx4SMXZEgj3QmLXjcDLDuJBTU7/kWQ4I7S9E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040