UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KJk+xT+lF+tvrvHlM7a0ujfMIRDhiYT7uynkkEzevGE=' 
WHERE 
  key_id = '5064ae414f0a1fd9e242426418ac8cd89669a1cc7602be88f8c9393651c53ac6' 
  AND (
    token = 'KJk+xT+lF+tvrvHlM7a0ujfMIRDhiYT7uynkkEzevGE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037