UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P1HCb4IWVlVX8MTgiU0RHf2axts7iVEpt+8mPqZ5Pkw=' 
WHERE 
  key_id = '081e68ada54fab703825d9e90b38d23b1cae37bbd214d6cce126847ad84ed180' 
  AND (
    token = 'P1HCb4IWVlVX8MTgiU0RHf2axts7iVEpt+8mPqZ5Pkw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031