UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WlEg7Lw0RtQeCJ/NX8QCv0E3sWHM9gFygHL3uDMHjsM=' 
WHERE 
  key_id = '4641c807b536c459bd67f5716e0b7394e7997523b23dad2f1abcc62654bc7010' 
  AND (
    token = 'WlEg7Lw0RtQeCJ/NX8QCv0E3sWHM9gFygHL3uDMHjsM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023