UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V4JT7upBjDyavfDzTXmbbTi4oB4kHSvssCbpDQn+I38=' 
WHERE 
  key_id = '7da794c982bc1af9ed83a6a2623b32c7ca07ac3de84bc3e833a8948f13116705' 
  AND (
    token = 'V4JT7upBjDyavfDzTXmbbTi4oB4kHSvssCbpDQn+I38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029