UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+ouh63nYvA9Cz5i8Ui5e329dLtEqKEcO+a/96YXDLpQ=' 
WHERE 
  key_id = '69f14f2da38c3acdc920797ca5927cbfe5fac1407704b2be2cbfac396fd18073' 
  AND (
    token = '+ouh63nYvA9Cz5i8Ui5e329dLtEqKEcO+a/96YXDLpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044