UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CG14IhdXRcljJF5B7XDVnye2l1QkC/hzdPi3MThg4CQ=' 
WHERE 
  key_id = '647d24b0d2c3fc6b1db90d970b5f17bbfab489142051e8f23366188d04268532' 
  AND (
    token = 'CG14IhdXRcljJF5B7XDVnye2l1QkC/hzdPi3MThg4CQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017