UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tugonXiyrvCvr4nxetomGvNGM9bA2NizWY6NgYRd+bY=' 
WHERE 
  key_id = 'a4668b14d94e820703dd0725c6148b44461a1710a084d12e7ce91548ae7a2c1f' 
  AND (
    token = 'tugonXiyrvCvr4nxetomGvNGM9bA2NizWY6NgYRd+bY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017