UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '31xXi9ye7H9BlwVgwaqyQIzNm1ilm2RNmOWcq1iAqPM=' 
WHERE 
  key_id = 'd17b16ae04adf4c41f3d91c9076804503ec281e317230f73d05b2004c41303b1' 
  AND (
    token = '31xXi9ye7H9BlwVgwaqyQIzNm1ilm2RNmOWcq1iAqPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043